package com.ajk.server.bkcontroller;

import java.security.Principal;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.ajk.server.controller.access.ArgIndexForPrintLog;
import com.ajk.server.model.PatientEventDay;
import com.ajk.server.model.query.TreatmentQuery;
import com.ajk.server.model.response.ResultList;
import com.ajk.server.model.response.TreatmentRes;
import com.ajk.server.service.PatientEventDayService;
import com.ajk.server.service.PatientEventService;
import com.ajk.server.service.TreatmentService;

@RequestMapping("/admin/patient_event")
@RestController
public class AdminPatientEventController {
	Logger logger = LoggerFactory.getLogger(AdminPatientEventController.class);
	@Autowired
	PatientEventService patientEventService;

	@Autowired
	PatientEventDayService patientEventDayService;
	
	@Autowired
	TreatmentService treatmentService;

	/**
	 *就诊记录列表
	 */
	@ArgIndexForPrintLog(indexes={0})
	@RequestMapping(value = "/{userId}/treatment/list", method = RequestMethod.GET)
	public ResultList<TreatmentRes> findMyEasemodAccount(@PathVariable("userId")Integer userId, Integer startId,Integer endId,Integer start,Integer limit,Principal principal){
		TreatmentQuery query = new TreatmentQuery();
		query.setStartId(startId);
		query.setStart(start);
		query.setEndId(endId);
		query.setLimit(limit);
		query.setUserId(userId);
		List<TreatmentRes> res = treatmentService.findTreatmentByQuery(query);

		return new ResultList<TreatmentRes>(res);
	}

	/**
	 *血压周期表
	 */
	@ArgIndexForPrintLog(indexes={0})
	@RequestMapping(value = "/{userId}/week_blood_press", method = RequestMethod.GET)
	public ResultList<PatientEventDay> findWeekBloodPress(@PathVariable("userId")Integer userId,Principal principal){
		List<PatientEventDay> list = patientEventDayService.findWeekBloodPress(userId);
		return new ResultList<>(list);
	}
}
